/*
 *	serialtest.c
 *	Basic serial commands, directed at use by arduinolib
 *
 *	Originally authored by Ian Hills - icopy11@gmail.com
 * 	Copyright 2010
 *	Distributed under the terms of the GNU General Public License
 *	And is distributed with NO WARRANTY.
 *	You should have received a copy of the GNU General Public License
 *      along with this program. If not, see <http://www.gnu.org/licenses/>.
 */


#include <stdio.h>
#include <string.h>  /* String function definitions */
#include <unistd.h>  /* UNIX standard function definitions */
#include <termios.h> /* Terminal definitions */
#include "seriallib.h"

int
main(int arg, char *args[])
{
	int port;
	unsigned char output[4];
	unsigned char input [4];

	char READ = 0;
	output[0]= 251; 
	output[1]= 251; 
	output[2]= 251; 
	output[3]= 251; 

	port = open_port("/dev/ttyUSB0");
	set_baud(port,B19200);
	write_bytes(port, output);

	while(READ == 0){
		read_bytes(port,input,4);
		printf("c%, c%, c%, c% ",output[0],output[1],output[2], output[3]);
	}
	close_port(port);
	return 0;
}

